package com.ccc.demoboot.controller;

import com.ccc.demoboot.common.R;
import com.ccc.demoboot.pojo.Department;
import com.ccc.demoboot.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author wz
 * @Date 2024/7/10 8:35
 * @PackageName:com.ccc.demoboot.controller
 * @ClassName: DepartmentController
 */
@RequestMapping("/department")
@RestController
public class DepartmentController {
    @Autowired
    DepartmentService departmentService;


    /**
     * 查询所有部门信息
     * @return
     */
    @PostMapping("/select")
    public R selectAll(){
        List<Department> list = this.departmentService.list();
        return new R().add("list",list);
    }
}
